package com.ruihu.admin.module.business.tasknode.domain.vo;

import com.ruihu.admin.module.business.tasknode.domain.dto.DefectTypeDTO;
import com.ruihu.admin.module.business.tasknode.domain.dto.NodeInstProcessDefectDTO;
import com.ruihu.admin.module.business.tasknode.domain.entity.DefectTypeEntity;
import lombok.Data;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;

/**
 *  [ 缺陷类型配置 ]
 *
 * @author Tony
 * @version 1.0
 * @company 瑞虎（南京）信息技术有限公司
 * @copyright (c) 瑞虎（南京）信息技术有限公司Inc. All rights reserved.
 * @date  2022-09-04 10:46:11
 * @since JDK1.8
 */

@Data
public class DefectTypeVO {

    @ApiModelProperty("主键")
    private Long id;

    @ApiModelProperty("任务环节ID")
    private Long taskNodeId;

    @ApiModelProperty("任务环节名称")
    private String taskNodeName;

    @ApiModelProperty("缺陷类型ID")
    private Long defectTypeId;

    @ApiModelProperty("缺陷名称")
    private String defectName;

    @ApiModelProperty("描述")
    private String remark;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty("创建人")
    private String createByName;

    public DefectTypeVO() {
    }

    public DefectTypeVO(NodeInstProcessDefectDTO nodeInstProcessDefectDTO) {
        this.defectTypeId = nodeInstProcessDefectDTO.getDefectTypeId();
        this.defectName = nodeInstProcessDefectDTO.getDefectName();
    }


    public static DefectTypeVO convertToDefectTypeVO(DefectTypeDTO dto) {
        if (dto == null) {
            return null;
        }
        DefectTypeVO vo = new DefectTypeVO();
        vo.setId(dto.getId());
        vo.setTaskNodeId(dto.getTaskNodeId());
        vo.setTaskNodeName(dto.getTaskNodeName());
        vo.setDefectTypeId(dto.getDefectTypeId());
        vo.setDefectName(dto.getDefectName());
        vo.setCreateTime(dto.getCreateTime());
        vo.setUpdateTime(dto.getUpdateTime());
        return vo;
     }

    public static DefectTypeVO convertToDefectTypeVO(DefectTypeEntity entity) {
        if (entity == null) {
            return null;
        }
        DefectTypeVO vo = new DefectTypeVO();
        vo.setId(entity.getId());
        vo.setDefectName(entity.getDefectName());
        vo.setCreateTime(entity.getCreateTime());
        vo.setUpdateTime(entity.getUpdateTime());
        return vo;
    }

    public static DefectTypeVO convertToDefectTypeVO(NodeInstProcessDefectDTO dto) {
        if (dto == null) {
            return null;
        }
        DefectTypeVO vo = new DefectTypeVO();
        vo.setDefectTypeId(dto.getDefectTypeId());
        vo.setDefectName(dto.getDefectName());
        return vo;
    }
}
